#ifndef _DUAL_STACK_SOCKET_H_
#define _DUAL_STACK_SOCKET_H_

#include <netinet/in.h>

/**
* 1.1.1.1 	addr_type_ipv4
* ::1 		addr_type_ipv6
*/
enum address_type
{
    addr_type_ipv4,
    addr_type_ipv6
};

enum protocol_type
{
	protocol_type_tcp = 0,
	protocol_type_udp = 1
};

struct union dual_sockaddr_in
{
    struct sockaddr_in addr4;
    struct sockaddr_in6 addr6;
};

typedef struct dualstack_socket_s* dualstack_socket_t;

dualstack_socket_t create_dual_socket(const char* address, unsigned int port, int protocal);
int destroy_dual_socket(dualstack_socket_t sock);

struct sockaddr* get_sockaddr(dualstack_socket_t s);
int get_sockaddr_len(dualstack_socket_t s);
int get_socket_fd(dualstack_socket_t s);

#endif

